// 全局事件
export default {
    install (Vue, options) {
        // 路由跳转
        Vue.prototype.toUrl = function (url) {
            this.$router.push({
                path: url
            })
        };
        // 路由跳转带参数 打开对应的tabs
        Vue.prototype.toUrlTabs = function (name,params) {
            this.$router.push({
                name: name,
                params: {
                    activeName: params
                }
            })
        };
        // 重置表单
        Vue.prototype.toReset = function (value) {
            // console.log(value);
            this.$refs[value].id = '';
            this.$refs[value].resetFields();
            this.btnLoading = false;
        };

        // 强制输入框只能输入数字
        Vue.prototype.inputOnlyNumber = function (value) {
            console.log(value)
            let num;
            if(typeof value != "number") {
                num = Number(value.replace(/\D/g, ''))
                console.log(1)
            } else {
                num = value
                console.log(2)
            }
            console.log(num)
            return num
            console.log('vue',Vue)
            console.log('this',this)
        }
    }
}
